//
//  HTHomeSearch.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/13.
//

import SwiftUI

struct HTHomeSearch: View {

  var var_popular: HTSearchPopular = HTSearchPopular()
  @State private var var_showPushToSearch: Bool = false

  var body: some View {
    ZStack{
      NavigationLink(destination: HTSearchScreen(var_placeholder: var_popular.var_title ?? ""), isActive: $var_showPushToSearch) {
        EmptyView()
      }

      HStack(spacing: 6){
        Image("search")
          .frame(width: 14, height: 14)
        Text(var_popular.var_title ?? "")
          .lineLimit(1)
          .font(.system(size: 12))
          .foregroundColor(Color.white)
      }
      .frame(maxWidth: .infinity, minHeight: 36, alignment: .leading)
      .padding(.horizontal, 10)
      .background(Color.white.opacity(0.2))
      .clipShape(Capsule())
      .onTapGesture {
        var_showPushToSearch = true
        HTNetworkManager().ht_requestForBuried(.htEnumMomeMClNew(var_kid: "1"))
      }
    }
  }
}
